<template>
	<view id="app">
		<view class="container fdc bgw">
			<view class="df aic mb20 bdt1s brcce" v-for="(item,index) in list" :key="index">
				<view class="df fdc aic plr20 ptb20">
					<view class="f32 mb20"> 第{{item.order}}期 </view>
					<view class="f26 c999">开营：{{item.start_time}} 至 {{item.end_time}} </view>
				</view>
				<view class="w120 cinfo f28" v-if="item.is_show == 1">
					报名中
				</view>
				<view class="w120 c999 f28" v-else>
					已结营
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	let that;
	export default {
		data() {
			return {
				id:0,
				list:[],
				page:1,
				more:true,
				nodata:true,
			}
		},
		onLoad(e){
			this.id =e.id;
			that = this;
			that.getList();
		},
		onReachBottom(){
			if(that.more == false){
				return false;
			}
			that.getList();
		},
		methods: {
			getList:function(){
				let page = that.page
				that.request({
					url:'/api/course/timer',
					data:{
						page:page,
						course_id:this.id
					},
					success:function(res){
					if(res.code == 200){
						if(page == 1){
							that.list = res.data;
							if(res.data.length == 0){
								that.nodata=false;
							}
						}else{
							that.list.push(...res.data)
						}
						that.more = res.data.length < 10 ? false : true;
						that.page=page+1;
					}
				}})
			},
		}
	}
</script>

<style>

</style>
